package almm;

import java.util.Set;

//	uses Template method pattern (http://en.wikipedia.org/wiki/Template_method_pattern)

public abstract class IndividualDiscreteProcess { // P = (s_0; f ; S_N; S_G)

	//private Set<GeneralizedState> notAdmissibleStates = null; // S_N
	//private Set<GeneralizedState> goalStates = null; // S_G

//	public IndividualDiscreteProcess(GeneralizedState initialState,
		//	Set<GeneralizedState> notAdmissibleGeneralizedStates,
	//		Set<GeneralizedState> goalStates) {
		//this.notAdmissibleStates = notAdmissibleGeneralizedStates;
		//this.goalStates = goalStates;
//	}

	//public IndividualDiscreteProcess(GeneralizedState initialState) {
		//this(initialState, new HashSet<GeneralizedState>(),
			//	new HashSet<GeneralizedState>());
//		if (initialState.isNotAdmissibleState())
//			notAdmissibleStates.add(initialState);
	//	else if (initialState.isGoalState())
		//	goalStates.add(initialState);
//	}

	public GeneralizedState next(ControlDecision u, GeneralizedState s) throws Exception {
		ProperState nextProperState = s.getProperState().next(u, s.getT());
		TimeInstant nextTimeInstant = s.getT().next(u, s.getProperState());
		return this.getGeneralizedState(nextProperState, nextTimeInstant);
	}

	protected abstract GeneralizedState getGeneralizedState(
			ProperState properState, TimeInstant t) throws Exception;

	public abstract Set<GeneralizedState> getNotAdmissibleGeneralizedStates();

	public abstract Set<GeneralizedState> getGoalStates();
}